package controllers;

import java.util.List;

import models.Member;
import models.Sale;
import models.TradeProductList;
import play.db.jpa.JPABase;
import play.mvc.*;
import util.ConstKey;

/**
 * 我的相关
 * @author sun
 *
 */
@With(PermissionsController.class)
public class MyController extends Controller {
    public static void index() {
    	
    	final int limitSize=10;
    	
    	String memberid = session.get(ConstKey.sessionkey.memberid.getValueString());
    	Long memID = Long.valueOf(memberid);
		Member member = models.Member.findById(memID);
    	renderArgs.put("member", member);
    	
    	List<TradeProductList> tradeProductList = TradeProductList.findByMemberID(memID,limitSize);
    	renderArgs.put("TradeProductList", tradeProductList);
    	
    	List<Sale> sales = Sale.findByMemberID(memID,limitSize);
    	renderArgs.put("sales", sales);
    	
    	
    	
        render();
    }

}
